import { ElementEntity } from './ElementEntity';
import { COLOR, formarColor, CreatePosition } from '../Config'


export default class LabelEntity extends ElementEntity {
    constructor(options = {}) {
        super(options.id, options, options.onClick, options.onRightClick);
        this.EntityTypeName = 'ElementEntity'
        this.text = options.text || '';
        this.color = formarColor(options.color);
        this.BGColor = formarColor(options.BGColor);
        this.Entity.position = CreatePosition(options.point);
        this.Entity.label = {
            text: this.text,
            font: '10pt Source Han Sans CN', //字体样式
            showBackground: !!options.BGColor, //是否显示背景颜色
            fillColor: this.color || COLOR.LIGHT_BLUE,
            backgroundColor: this.BGColor || COLOR.DARK_GREEN,
            style: Cesium.LabelStyle.FILL, //label样式
            verticalOrigin: Cesium.VerticalOrigin.TOP, //垂直位置
            horizontalOrigin: Cesium.HorizontalOrigin.CENTER, //水平位置
            pixelOffset: new Cesium.Cartesian2(options.OffsetX || 0, options.OffsetY || 0), //偏移
            // eyeOffset: new Cesium.Cartesian3(0, 0, -10000),
            disableDepthTestDistance: Number.POSITIVE_INFINITY,
        }
    }
}
